// Copyright 2013 The Go Circuit Project
// Use of this source code is governed by the license for
// The Go Circuit Project, found in the LICENSE file.
//
// Authors:
//   2013 Petar Maymounkov <p@gocircuit.org>

package ns

import (
	"bytes"

	"circuit/kit/iomisc"
	"circuit/kit/rh"
)

func NewStringFID(screen func() string) rh.FID {
	return RegulateFork(func() UnregulatedFID {
		return NewReaderFID(
			"string",
			iomisc.ReaderNopCloser(bytes.NewReader([]byte(screen()))),
		)
	})
}

func NewConstStringFID(screen string) rh.FID {
	return NewStringFID(func() string { return screen })
}
